home *** CD-ROM | disk | FTP | other *** search
/ Amiga Developer CD 2.1 / Amiga Developer CD v2.1.iso / NDK / NDK_3.1 / Examples1 / PCMCIA / PCMCIA.Peripherals < prev    next >
Encoding:
Text File  |  1999-10-27  |  13.5 KB  |  302 lines

  1.  
  2. Issues for PCMCIA Peripheral Manufacturers
  3. ==========================================
  4. (c) Copyright 1992-1999 Amiga, Inc.  All Rights Reserved
  5. Preliminary
  6.  
  7.  
  8.    ************************************************************************
  9.    *                                      *
  10.    *                COPYRIGHTED DEVELOPER MATERIALS                *
  11.    *                                      *
  12.    ************************************************************************
  13.  
  14.    THIS INFORMATION IS COPYRIGHTED.
  15.  
  16.    THIS INFORMATION MAY NOT BE REDISTRIBUTED, DISCLOSED,
  17.    OR DUPLICATED, IN WHOLE OR IN PART, IN ANY MANNER OTHER THAN AS
  18.    SPECIFIED IN A SIGNED AGREEMENT WITH AMIGA.
  19.  
  20.    ************************************************************************
  21.    *                                      *
  22.    *                DISCLAIMER                  *
  23.    *                                      *
  24.    *   THIS SOFTWARE AND INFORMATION IS PROVIDED "AS IS".          *
  25.    *   NO REPRESENTATIONS OR WARRANTIES ARE MADE WITH RESPECT TO THE      *
  26.    *   ACCURACY, RELIABILITY, PERFORMANCE, CURRENTNESS, OR OPERATION      *
  27.    *   OF THIS SOFTWARE AND INFORMATION, AND ALL USE IS AT YOUR OWN RISK. *
  28.    *   NEITHER AMIGA NOR THE AUTHORS ASSUME ANY RESPONSIBILITY OR      *
  29.    *   LIABILITY WHATSOEVER WITH RESPECT TO YOUR USE OF THIS SOFTWARE      *
  30.    *   AND INFORMATION.                              *
  31.    *                                      *
  32.    ************************************************************************
  33.  
  34. This document covers two topics -
  35.  
  36.  1. Issues for manufacturers of PCMCIA card peripherals for Amiga
  37.     models equipped with a built-in PCMCIA slot.
  38.  
  39.  2. Issues for manufacturers of external PCMCIA card reader/writer
  40.     peripherals who wish to sell their peripheral as a compatible
  41.     add-on for Amiga models NOT equipped with a built-in PCMCIA
  42.     slot.
  43.  
  44.  
  45. Issues for developers of PCMCIA slot hardware cards
  46. ===================================================
  47.  
  48. This section will be rather brief but should also be read by manufacturers
  49. of PCMCIA reader/writer peripherals who wish to emulate the Amiga PCMCIA
  50. slot.
  51.  
  52. ---------------------------------------------------------------------------
  53. Your main reference should be the ``PCMCIA Specifications'':
  54.  
  55.     PCMCIA Resource Ref Book - approximately $7.50
  56.     PCMCIA Specifications - approximately $250.00 
  57.  
  58.     PCMCIA - Phone 408-720-0107 (USA)
  59.  
  60. This is the PCMCIA order number.  Call and get exact pricing, and then you
  61. can FAX an order direct to PCMCIA.  The prices above are for non-members.
  62.  
  63. In addition, read the card.resource autodoc "cardres.doc".
  64. ---------------------------------------------------------------------------
  65.  
  66. The current Amiga PCMCIA slot supports Type 1 and Type 2 cards and is
  67. based on the Release 2.0 PCMCIA specification.
  68.  
  69. The Amiga card.resource supports a single PCMCIA card with a single
  70. DEVICE tuple - i.e. a card may be RAM, or a disk, or AmigaXIP, or an
  71. I/O device.   This includes boot-time support (calling of AmigaXIP
  72. code, booting from a disk-format card, or adding of unformatted SRAM
  73. or DRAM cards to the system memory list), plus support for hot insertion
  74. and removal of cards with on-the-fly config reading of newly inserted
  75. cards.
  76.  
  77. Other important supported features include:
  78.  
  79.   Interrupts on status change (WP, BVD1, BVD2, and RDY/BSY, CC detect)
  80.   Status register read
  81.   Vpp control (tough do if you don't have 5V, and 12V available)
  82.   Reset on removal (enable/disable)
  83.  
  84. The Amiga PCMCIA slot is accessed via direct memory access with PCMCIA
  85. common memory appearing at $600000 through $9FFFFF inclusive in the
  86. Amiga's memory map. This is within the address space accessible by the
  87. 68000 CPU, and uses the upper 4 megabytes of address space for FAST
  88. ram expansion. Attribute memory appears at $A00000 through $A1FFFF.
  89.  
  90. Some manufacturers may wish to build multipurpose cards, or peripherals
  91. to expand the number of card slots.
  92.  
  93. Some issues to be aware of are:
  94.  
  95.  - As stated already, the OS software supports 1 card with 1 device tuple
  96.  
  97.  - AmigaXIP (execute-in-place) software is extremely unlikely to work if
  98.    forced to execute at different address (the code would have to be
  99.    totally position independent)
  100.  
  101.  - OS support for disk-formatted cards requires the interrupts.
  102.    But note that the card.device does ask the card.resource where
  103.    the card is, and where the disk is on the card...  There might be
  104.    some possibilities here for moving the base address for disk-formatted
  105.    cards.
  106.  
  107.  - Any future Amigas with PCMCIA slot may leave less of the card sticking
  108.    out - i.e. a non-standard card or cage may not fit in some future
  109.    model or case change.
  110.  
  111.  
  112. Some theoretical possibilities...
  113.  
  114.  - An expander with address multiplexer and multiple slots each containing
  115.    a PCMCIA RAM card so that (for example) two 2-meg RAM cards could
  116.    be installed.
  117.  
  118.  - An expander with address multiplexer and multiple slots, with the
  119.    first slot containing a PCMCIA card with AmigaXIP RAM or ROM code
  120.    which could configure and drive various I/O cards in a second slot,
  121.    and perhaps add system RAM from a third slot.
  122.  
  123.  
  124.  
  125. Issues for peripheral PCMCIA card readers/writers
  126. =================================================
  127.  
  128. We have had several inquiries from manufacturers of PCMCIA peripherals
  129. who wish to make an Amiga version of their peripheral, and wish to
  130. emulate as much as possible of the Amiga OS support of the built-in
  131. PCMCIA slot.
  132.  
  133. This is extremely complex.  Full emulation would be very difficult.
  134.  
  135. Amigas with built-in PCMCIA slots access the slot as a DMA device,
  136. i.e. the processor directly accesses the PCMCIA card memory at the
  137. fixed addresses of $600000 (common memory) and $A00000 (attribute
  138. memory).
  139.  
  140. Amigas with PCMCIA slots contain the ROM software which handles the
  141. PCMCIA card as a whole (card.resource), and the disk-image track portion
  142. of a disk-formatted PCMCIA card (card.device).  Note however, that
  143. developers may sometimes run softloaded versions of kickstart which
  144. contain the card device and resource on machines which do not have
  145. a PCMCIA slot (eg. an A600 kickstart softloaded on an A2500).
  146. In addition, it is possible that we may someday use ROMs which contain
  147. card.device on machines that have no PCMCIA slot (because this would
  148. be less expensive than making different ROMs which are equivalent
  149. except for this unused device.)
  150.  
  151. The PCMCIA support in the relevant Amiga Kickstart ROMs and Workbench
  152. is specific to the built-in PCMCIA slot, card.resource, and card.device.
  153. This includes special boot-time accesses which check for and call Amiga
  154. code in Amiga execute-in-place (AmigaXIP) cards, support for auto-mounting
  155. and booting from a disk-formatted card, sensing and adding RAM-identified
  156. cards as system RAM, and support for hot insertion and removal of disk
  157. formatted cards, including special support for re-reading and adapting
  158. to changes in the card disk geometry as different cards are inserted.
  159. All of this is hardcoded to use card.resource, card.device, and direct
  160. memory access of the PCMCIA card in the OS software of of Amigas that
  161. are shipped with a PCMCIA slot.
  162.  
  163.  
  164.  
  165. Partial emulation to support disk-formatted PCMCIA cards only
  166. =============================================================
  167.  
  168. The following text applies to all non-DMAable PCMCIA peripherals
  169. (for example, one which attaches to the parallel port).
  170.  
  171. One hardware note - the Amiga parallel (Centronics) port does
  172. not contain as many special software-controllable lines as a
  173. PC parallel port.  Most read-write PC parallel port peripherals
  174. make heavy use of all available software-controllable lines on the
  175. PC for data transfer and handshaking.  See the A500/A2000 Technical
  176. Reference Manual (a CATS support material) which contains a
  177. comparative chart of the Amiga and PC parallel ports.  See also
  178. the Amiga Hardware Manual.
  179.  
  180. Again, you must write your own card.device-style trackdisk-emulating
  181. Amiga device driver.  This will allow you to mount your device as
  182. an Amiga disk and have the Amiga filesystem treat it as such.
  183. Note that Amiga PCMCIA disk-format cards contain a trackdisk-like
  184. disk image of arbitrary size preceded by PCMCIA tuples which
  185. describe the specifications and format of the card, and the location
  186. of the disk image.  See the RKM Devices volume sample device code for
  187. an example of a trackdisk-emulating device.  Note however that the
  188. sample device code does not implement disk change interrupt handling.
  189. See the PCMCIA Card Standard manual for information on PCMCIA tuples.
  190.  
  191. If you wanted to support booting from such a device, this would
  192. require early (ie. pre-boot) system startup of your device code.
  193. To do this, you would either need to have a legal autoconfig Amiga
  194. Zorro bus expansion card containing ROM code, or an illegal
  195. card appearing at $F00000.  The mechanism of autoconfig ROM drivers
  196. is covered in the expansion library chapter of the RKM Libraries
  197. volume.  Most people do this WORD-wide with pairs of eproms containing
  198. the autoconfig ID information and the driver.  Such a ROM driver is
  199. best written in position-independent 68000 assembler and run directly
  200. in the ROM.  The $F00000 mechanism is simply that the the OS currently
  201. looks for and calls any ROMTAGs found in $F00000 memory. (See
  202. exec/resident.h and the exec autodoc for InitResident).
  203.  
  204. If you do not plan to support booting from a PCMCIA card, then
  205. you can add your device to the system after boot-up by starting it
  206. up with a program or by mounting a volume which uses your device
  207. (the system will then load your device driver from the DEVS: drawer).
  208. This means you won't need to build an Amiga expansion card.
  209.  
  210. In either case:
  211. You will need to write your own driver code to emulate the Amiga
  212. trackdisk.device for reading , writing, formatting, changing, etc.
  213. Our sample.device code (in A-W archives on Fish disk 344) might be
  214. a good place to start.  See also the text about ROM drivers in the
  215. expansion chapter.  Our Amiga card.device is be pretty much like
  216. trackdisk except it does not support the commands RAWREAD, RAWWRITE,
  217. GETNUMTRACKS and GETDRIVETYPE.  It does support GETGEOMETRY, and
  218. for hot insertion/removal, it supports the CHANGEINT-related commands.
  219.  
  220. Unfortunately, we have no example code or docs on how to implement
  221. removability, and insertion of different cards with different size disks.
  222. This will require mounting (and even removing, if no outstanding Locks
  223. exist) volume nodes from the DOS device list on the fly.  And if different
  224. size disks are inserted, it may be necessary to rebuild the phisycal
  225. device node on the DOS device list also on the fly.
  226.  
  227.  
  228.  
  229. How full emulation might be accomplished - and is it worth it:
  230. ==============================================================
  231.  
  232. Full emulation of the built-in Amiga PCMCIA slot requires a DMA.
  233.  
  234. Theoretically, the following could be done:
  235.  
  236.  
  237. It may be possible to build a Zorro II  autoconfig card of small size
  238. which asks to be configured in I/O space (~$E90000) and contains a legal
  239. autoconfig ROM driver, but ALSO responds to accesses at $600000-$9FFFFF
  240. and $A00000 - $A1FFFF.
  241.  
  242. Note that this in itself means that anyone using the card will lose
  243. 1/2 of their Amiga expansion memory space for this card.
  244. At $600000 and $A00000, the expansion card must present the memory
  245. of any inserted PCMCIA card in a DMA-readable-and-writeable manner. 
  246. Interrupt hardware would be required to signal insertion/removal.
  247.  
  248. At boot time, the ROM driver would behave as an autoboot driver
  249. (see RKM Libraries - expansion library chapter).
  250.  
  251. During system initialization the ROM autoboot driver code would need to
  252. 1. add its own card.resource-type arbitration resource
  253. 2. add its own card.device-style trackdisk-emulating device to the system
  254. 3. look for any inserted AmigaXIP card and call its code, emulating
  255. the system support for such cards.
  256.  
  257.  
  258. At RomTag INIT time, I imagine it would check for an inserted card, and
  259. check the PCMCIA tuples to see if it is a disk (see PCMCIA Card Standard).
  260. If it is a disk, it would create a suitable device node and boot node for it
  261. so the system could boot from it (see RKM Libraries expansion chapter).
  262.  
  263. If the card was instead a plain RAM card, it would add it to the system
  264. memory list (see exec autodocs, AddMemList).
  265.  
  266. If it is an Execute-In-Place, it may be too early at this time to call
  267. the AmigaXIP's romtag.  Instead, the driver may need to set up a dummy
  268. device and boot node, and then when it is called at Boot Time, it would
  269. InitResident the romtag on the XIP card.  If that initialization returns
  270. the driver would exit its boot time code without initializing DOS so that
  271. the system will try to boot off the next bootable device.
  272. Note that if AmigaXIP code returns, its return value (in D0) signifies
  273. whether or not the card should be considered removable.  TRUE means
  274. not removable, FALSE means removal is OK.
  275.  
  276. If a non-removable card is ever removed, the driver must reboot the system.
  277.  
  278. If a removable card is removed (ie. AmigaXIP which has served its purpose
  279. or has installed its software in RAM), then the ROM driver will need to be
  280. able to recoginize inserted disks on the fly, create device and volume node
  281. for them, etc.
  282.  
  283. Note that we could theoretically ship machines which have no PCMCIA
  284. slot but use ROMs which happen to contain the card device and resource.
  285. There is no guarantee if you choose to name YOUR device and resource
  286. the same as ours, that there will not be a conflict in some systems.
  287. You can use different names to avoid possible conflict.  However, this
  288. will also require that you write your own utilities since ours are
  289. hardcoded for the card.resource and card.device.
  290.  
  291.  
  292. Additional References:
  293.     A500/A2000 Schematics and Expansion Specs (physical)
  294.     Addison-Wesley Amiga RKM Libraries (exec, expansion)
  295.     Addison-Wesley Amiga RKM Devices (trackdisk, sample device)
  296.     Sample device code in A-W archives on Fish disk 344
  297.     FmsDisk example code by Matt Dillon (Fish Disk 294)
  298.     Other sample devices on the Fish Disks
  299.     Exec autodocs (AddResource, AddMemList, InitResident, etc.)
  300.     PCMCIA Specifications
  301.  
  302.